<?php

/**
 * Diploma service class for communication between controllers and
 * persistent storage
 */

class Core_Service_Diploma extends RedCross_Service_ServiceAbstract {
    /**
     * Constructor
     * @param Core_Gateway_Diploma $gateway
     */
    public function __construct(Core_Gateway_Diploma $gateway) {
        parent::__construct($gateway, 'Core_Model_Diploma');
    }

    public function create($description, $fileName, $memberId) {
        $diploma = new Core_Model_Diploma();
        $diploma->description = $description;
        $diploma->file_name = $fileName;
        $diploma->member_id = $memberId;

        return $diploma->save() !== false;
    }

    public function fetchAllForMemberId($memberId) {
        return $this->getGateway()->fetchAllForMemberId($memberId);
    }
}

?>
